package com.example.myapplication;

import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.TextView;

import androidx.activity.EdgeToEdge;
import androidx.appcompat.app.AppCompatActivity;
import androidx.core.graphics.Insets;
import androidx.core.view.ViewCompat;
import androidx.core.view.WindowInsetsCompat;

public class MainActivity extends AppCompatActivity {

    private TextView textV;
    private int Number = 0;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        textV = findViewById(R.id.tv_info);
        Button but_mid = findViewById(R.id.but_mid);
        Button but_rig = findViewById(R.id.but_rig);
        Button but_lef = findViewById(R.id.but_lef);

        but_lef.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Number--;
                updateNumber();
            }
        });

        but_rig.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Number++;
                updateNumber();
            }
        });

        but_mid.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Number=0;
                updateNumber();
            }
        });
    }
    private void updateNumber() {
        textV.setText(String.valueOf(Number));
    }
}